# ①面向对象-继承
class Person: # 父类 默认继承了object
    def __init__(self,name,age):
        self.name = name
        self.age = age

    def show(self):
        print(f'我叫{self.name}今年{self.age}岁')

# Student类继承了Person类
class Student(Person):
    def __init__(self,name,age,stuno):
        super().__init__(name,age) # 调用父类的初始化方法给name age赋值
        self.stuno = stuno

    def show(self): # 方法重写
        print(f'我叫{self.name}今年{self.age}岁学号是{self.stuno}')

# Doctor类继承了Person类
class Doctor(Person):
    def __init__(self,name,age,dep):
        super().__init__(name,age)
        self.dep = dep

    def show(self): # 方法重写
        super().show()
        print(f"我来自{self.dep}部门")

stu = Student('wez',19,'20161308083')
doc = Doctor('ssq',50,'外科')

stu.show()
doc.show()
